package com.attendance.sz.utils;

import android.content.Context;

import java.util.LinkedList;




public class Session {
	
	private LinkedList link;
	public Session(){
        link = new LinkedList();
    }
    public void myAdd(Object obj){
        link.addFirst(obj);
    }
    public Object myGet(){
        return link.removeLast();//改为removeLast这样就可以是堆栈和队列的转换
    }
    public boolean isNull(){
        return link.isEmpty();
    }
    
	/** session SharedPreference name */
	public static final String SESSION_FILE = "attendance_session";

	public static final SharePrefsHelper sessionSp = new SharePrefsHelper(			
	           MyApplication.getAppContext(), SESSION_FILE, Context.MODE_PRIVATE);

	private static String getString(String key, String def) {
		return sessionSp.getString(key, def);
	}

	private static void setString(String key, String value) {
		sessionSp.setString(key, value);
	}
	
	public static final String ONE_PASSWORD = "one_password";
	public static void setOnePassword(String value) {
		setString(ONE_PASSWORD, value);
	}

	public static String getOnePassword() {
		return getString(ONE_PASSWORD, "");
	}
	
	public static final String SECOND_PASSWORD = "second_password";
	public static void setSecondPassword(String value) {
		setString(SECOND_PASSWORD, value);
	}

	public static String getSecondPassword() {
		return getString(SECOND_PASSWORD, "");
	}
	
	public static final String COMPANYINFO = "companyinfo";
	public static void setCompanyInfo(String value) {
		setString(COMPANYINFO, value);
	}

	public static String getCompanyInfo() {
		return getString(COMPANYINFO, "欢迎使用宇川智能考勤机系统");

	}
	public static final String COM = "com";
	public  static  void  setCom(String value){
		setString(COM, value);
	}
	public static String getCom() {// 广西省桂林市党委校 默认M4 现在用的主板，M3口有干涉
		return getString(COM, "4");
	}

	public static final String MACHINE_NO = "machine_no";//机器号，人工输入的
	public static void setMachineNo(String value) {
		setString(MACHINE_NO, value);
	}

	public static String getMachineNo() {
		return getString(MACHINE_NO, "901");
	}
	
	public static final String OVER_TIME = "over_time";
	public static void setOverTime(String value) {
		setString(OVER_TIME, value);
	}

	public static String getOverTime() {
		return getString(OVER_TIME, Constants.Over_Time);//"5");//超时时间
	}
	
	public static final String INTERVAL_TIME = "interval_time";
	public static void setIntervalTime(String value) {
		setString(INTERVAL_TIME, value);
	}

	public static String getIntervalTime() {
		return getString(INTERVAL_TIME, "3");//"2");//间隔时间
	}
	
	public static final String LOCAL_IP = "local_ip";
	public static void setLocalIp(String value) {
		setString(LOCAL_IP, value);
	}

	public static String getLocalIp() {
		return getString(LOCAL_IP, "127.0.0.1");
	}
	
	public static final String LOCAL_NETMASK = "local_netmask";
	public static void setLocalNetMask(String value) {
		setString(LOCAL_NETMASK, value);
	}

	public static String getLocalNetMask() {
		return getString(LOCAL_NETMASK, "0");
	}
	
	public static final String LOCAL_GETWAY = "local_getway";
	public static void setLocalGetWay(String value) {
		setString(LOCAL_GETWAY, value);
	}

	public static String getLocalGetWay() {
		return getString(LOCAL_GETWAY, "0");
	}
	
	public static final String SERVER_IP = "server_ip";
	public static void setServerIp(String value) {
		setString(SERVER_IP, value);
	}

	public static String getServerIp() {
		return getString(SERVER_IP, "0");
	}
	
	public static final String SERVER_PORT = "server_port";
	public static void setServerPort(String value) {
		setString(SERVER_PORT, value);
	}

	public static String getServerPort() {
		return getString(SERVER_PORT, "0");
	}
	
	public static final String FIRST_REGISTER = "first_register";
	public static void setFirstRegister(String value) {
		setString(FIRST_REGISTER, value);
	}

	public static String getFirstRegister() {
		return getString(FIRST_REGISTER, "0");
	}
	
	public static final String Day_REGISTER = "day_register";
	public static void setDayRegister(String value) {
		setString(Day_REGISTER, value);
	}

	public static String getDayRegister() {
		return getString(Day_REGISTER, "0");
	}
	
	public static final String COMPANY_NO = "company_no";
	public static void setCompanyNo(String value) {
		setString(COMPANY_NO, value);
	}

	public static String getCompanyNo() {
		return getString(COMPANY_NO, "0");
	}
	
	public static final String SOCRET_INFO = "socret_info";
	public static void setSocretInfo(String value) {
		setString(SOCRET_INFO, value);
	}

	public static String getSocretInfo() {
		return getString(SOCRET_INFO, "0");
	}
	
	public static final String NETWORK_VERSION_NO = "network_version_no";
	public static void setNetWorkVesionNo(String value) {
		setString(NETWORK_VERSION_NO, value);
	}

	public static String getNetWorkVesionNo() {
		return getString(NETWORK_VERSION_NO, "0");
	}
	
	public static final String BLACKLIST_VERSION_NO = "blacklist_version_no";
	public static void setBlackListVesionNo(String value) {
		setString(BLACKLIST_VERSION_NO, value);
	}

	public static String getBlackListVesionNo() {
		return getString(BLACKLIST_VERSION_NO, "0");
	}
	
	public static final String OFFLINE_INFO = "offline_info";
	public static void setOfflineInfo(String value) {
		setString(OFFLINE_INFO, value);
	}

	public static String getOfflineInfo() {
		return getString(OFFLINE_INFO, "0");
	}
	
	public static final String DIVICE_NO = "device_no";//设备号即生产序列号，刷卡产生的
	public static void setDeviceNo(String value) {
		setString(DIVICE_NO, value);
	}

	public static String getDeviceNo() {
		return getString(DIVICE_NO, "0");
	}
	
	public static final String CAN_READCARD = "car_readcard";
	public static void setCanReadCard(String value) {
		setString(CAN_READCARD, value);
	}

	public static String getCanReadCard() {
		return getString(CAN_READCARD, "0");
	}
	
	public static final String CAN_INIT = "car_init";
	public static void setCanInit(String value) {
		setString(CAN_INIT, value);
	}

	public static String getCanInit() {
		return getString(CAN_INIT, "0");
	}
	
	public static final String DOWN_URL = "down_rul";
	public static void setDownUrl(String value) {
		setString(DOWN_URL, value);
	}

	public static String getDownUrl() {
		return getString(DOWN_URL, Constants.Down_Url);//"http://211.149.198.72:8080/examples/attendance_android.apk";//"0");
	}
	public static final String DOWN_TIEM = "down_tiem";
	public static String getDownUrlTiem() {
		return getString(DOWN_TIEM, Constants.DownTiem_Url);//"http://211.149.198.72:8080/examples/attendance_android.apk";//"0");
	}
	public static void setDownUrlTiem(String value) {
		setString(DOWN_TIEM, value);
	}
	public static final String UpdateAuto_Flag = "UpdateAutoFlag";//这个XML中项
	public static void setUpdateAuto(String value) {
		setString(UpdateAuto_Flag, value);//对应的值
	}

	public static String getUpdateAuto() {
		return getString(UpdateAuto_Flag, "0");//对应的值 0---不自动升级,1---自动升级
	}
	
	public static final String ReBoot = "reboot";//这个XML中项
	public static void setReboot(String value) {
		setString(ReBoot, value);//对应的值
	}

	public static String getReboot() {
		return getString(ReBoot, "23:00");//对应的值重启
	}
	
	public static final String Residence_Time = "residence_time";//这个XML中项
	public static void setResidenceTime(String value) {
		setString(Residence_Time, value);//对应的值 停留时间
	}

	public static String getResidenceTime() {
		return getString(Residence_Time, "15");//对应的值界面停留时间
	}

	public static final String key = "key";//这个XML中项
	public static void setCardKey(String value) {
		setString(key, value);//对应的值 停留时间
	}

	public static String getCarKey() {
		return getString(key, "0");//对应的值界面停留时间
	}

	public static final String section = "section";//这个XML中项
	public static void setCardSection(String value) {
		setString(section, value);//对应的值 停留时间    //密钥
	}

	public static String getCarSection() {
		return getString(section, "0");//对应的值界面停留时间
	}
	public static final String Card = "Card";//这个XML中项
	public static void setCardName(String value) {
		setString(Card, value);//对应的值 停留时间
	}

	public static String getCardName() {
		return getString(Card, "0");//对应的值界面停留时间
	}
	//////////////////////////////////////////////////////////////////////////////////
	public static final String DOWNADV_URL = "downadv_rul"; //广告下载地址 改作图片服务地址
	public static void setDownAdvUrl(String value) {
		setString(DOWNADV_URL, value);
	}

	public static String getDownAdvUrl() {
		return getString(DOWNADV_URL, Constants.DownAdv_Url);//"http://211.149.198.72:8080/examples/12.zip";//"0");
	}

	public static final String DOWPhoto_URL = "downnPhoto_rul"; //广告下载地址 改作图片服务地址
	public static void setDownPhotoUrl(String value) {
		setString(DOWPhoto_URL, value);
	}

	public static String getDownPhotoUrl() {
		return getString(DOWPhoto_URL, Constants.DownPhoto_Url);//"http://211.149.198.72:8080/examples/12.zip";//"0");
	}

	public static final String AdvAuto_Flag = "AdvAutoFlag";//这个XML中项
	public static void setAdvAuto(String value) {
		setString(AdvAuto_Flag, value);//对应的值
	}

	public static String getAdvAuto() {
		return getString(AdvAuto_Flag, "0");//对应的值 0---不自动更新广告,1---更新广告
	}
	/////////////////////////////////////////////////////////////////////////////////
	
	
	///////////////////////////////////////////////////////////////////////////////
	public static final String MonitorFlag = "monitorflag";
	public static void setMonitorFlag(String value) {
	setString(MonitorFlag, value);
	}
	
	public static String getMonitorFlag() {
	return getString(MonitorFlag, "0");//对应的值 0---不保护自身程序,1---保护
	}
	///////////////////////////////////////////////////////////////////////////////	
	
	
	
	///////////////////////////////////////////////////////////////////////////////
	public static final String FtpServerFlag = "ftpserverflag";
	public static void setFtpServerFlag(String value) {
	setString(FtpServerFlag, value);
	}
	
	public static String getFtpServerFlag() {
	return getString(FtpServerFlag, "0");//对应的值 0---不开启ftp服务程序,1---开启ftp
	}
	///////////////////////////////////////////////////////////////////////////////	
	
	
	
	///////////////////////////////////////////////////////////////////////////////
	public static final String TelnetdFlag = "telnetdflag";
	public static void setTelnetdFlag(String value) {
	setString(TelnetdFlag, value);
	}
	
	public static String getTelnetdFlag() {
	return getString(TelnetdFlag, "0");//对应的值 0---不开启telnetd服务程序,1---开启telnetd
	}
	///////////////////////////////////////////////////////////////////////////////


	
	///////////////////////////////////////////////////////////////////////////////
	public static final String SERVERLOG_IP = "serverlog_ip";
	public static void setServerLogIp(String value) {
		setString(SERVERLOG_IP, value);
	}

	public static String getServerLogIp() {
		return getString(SERVERLOG_IP, "0");
	}
	
	public static final String SERVERLOG_PORT = "serverlog_port";
	public static void setServerLogPort(String value) {
		setString(SERVERLOG_PORT, value);
	}

	public static String getServerLogPort() {
		return getString(SERVERLOG_PORT, "0");
	}
	
	///////////////////////////////////////////////////////////////////////////////
	
	public static final String LogTran_Flag = "LogTranFlag";//这个XML中项
	public static void setLogTranFlag(String value) {
		setString(LogTran_Flag, value);//对应的值
	}

	public static String getLogTranFlag() {
		return getString(LogTran_Flag, "0");//对应的值 0---不传输日志到服务器,1---传输
	}
	
	
	
	
	///////////////////////////////////////////////////////////////////////////////
	public static final String CardType = "CardType";//这个XML中项
	public static void setCardType(String value) {
		setString(CardType, value);//对应的值
	}

	public static String getCardType() {
		return getString(CardType, "2");//对应的值 0x01-M1卡2.0结构，0x02-M1卡1.2结构，0x10-CPU卡1.0结构
	}
	///////////////////////////////////////////////////////////////////////////////
	
	///////////////////////////////////////////////////////////////////////////////
	public static final String SYNCHRONIZATION_TIME = "synchronization_time";
	public static void setSynchronizationTime(String value) {
		setString(SYNCHRONIZATION_TIME, value);
	}

	public static String getSynchronizationTime() {
		return getString(SYNCHRONIZATION_TIME, "3");////同步时间,即相差这么多秒才和主机同步
	}
	///////////////////////////////////////////////////////////////////////////////
	
	
	///////////////////////////////////////////////////////////////////////////////
	public static final String MONITOR_IP = "monitorip";//发往监控IP
	public static void setMonitorIp(String value) {
		setString(MONITOR_IP, value);
	}

	public static String getMonitorIp() {
		return getString(MONITOR_IP, "127.0.0.1");
	}
	///////////////////////////////////////////////////////////////////////////////


	public static final String TEST_CARD_IMG_NO = "test_card_img_no";//
	public static void setTestCardImgNo(String value) {
		setString(TEST_CARD_IMG_NO, value);
	}

	public static String getTestCardImgNo() {
		return getString(TEST_CARD_IMG_NO, "284684424");
	}
	///////////////////////////////////////////////////////////////////////////////

	public static final String AUTO_UPLOAD_NUM = "autp_upload_num";//
	public static void setAutoUploadNum(String value) {
		setString(AUTO_UPLOAD_NUM, value);
	}

	public static String getAutoUploadNum() {
		return getString(AUTO_UPLOAD_NUM, "0");
	}
	///////////////////////////////////////////////////////////////////////////////
	
	
	
	public static final String TEST_VALUE = "test_value";
	public static void setTestValue(String value) {
		setString(TEST_VALUE, value);
	}

	public static String getTestValue() {
		return getString(TEST_VALUE, "0");
	}
	
	public static void clearForLogout() {
		
		
	}


	public static void setVisibility(String value) {
		setString("Visibility", value);//对应的值
	}

	public static String getVisibility() {
		return getString("Visibility", "1");//对应的值 1 显示，0空图片
	}

	public static final String ENABLE_CAMERA = "ENABLE_CAMERA";
	public static void setEnableCameraValue(String value) {
		setString(ENABLE_CAMERA, value);
	}

	public static String getEnableCameraValue() {
		return  getString(ENABLE_CAMERA, "0");
	}
}
